apiVersion: apps/v1
kind: DaemonSet
metadata:
  creationTimestamp: null
  labels:
    app.kubernetes.io/name: kube-vip-ds
  name: kube-vip-ds
  namespace: kube-system
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: kube-vip-ds
  template:
    metadata:
      creationTimestamp: null
      labels:
        app.kubernetes.io/name: kube-vip-ds
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: node-role.kubernetes.io/master
                    operator: Exists
              - matchExpressions:
                  - key: node-role.kubernetes.io/control-plane
                    operator: Exists
      containers:
      - args:
        - manager
        env:
          - name: vip_arp
            value: "true"
          - name: vip_interface
            value: "{{ rke2_interface | default(ansible_default_ipv4.interface | default(ansible_default_ipv6.interface)) }}"
          - name: port
            value: "{{ rke2_api_port | default(6443) }}"
          - name: vip_cidr
            value: "{{ rke2_api_cidr | default('24') }}"
          - name: cp_enable
            value: "true"
          - name: cp_namespace
            value: kube-system
          - name: vip_ddns
            value: "false"
          - name: enableUPNP
            value: "false"
          - name: svc_enable
            value: "{{ rke2_kubevip_svc_enable }}"
          - name: svc_election
            value: "{{ rke2_kubevip_service_election_enable }}"
          - name: vip_leaderelection
            value: "true"
          - name: vip_leaseduration
            value: "{{ rke2_kubvip_leaseduration | default('5') }}"
          - name: vip_renewdeadline
            value: "{{ rke2_kubevip_renewdeadline | default('3') }}"
          - name: vip_retryperiod
            value: "{{ rke2_kubevip_retryperiod | default('1') }}"
          - name: vip_loglevel
            value: "{{ rke2_kubevip_loglevel | default('4') }}"
          - name: address
            value: "{{ rke2_api_ip }}"
          - name: prometheus_server
            value: ":{{ rke2_kubevip_metrics_port }}"
          - name: lb_enable
            value: "{{ rke2_kubevip_ipvs_lb_enable }}"
    {% if rke2_kubevip_args is defined %}
    {% for item in rke2_kubevip_args %}
          - name: {{ item.param }}
            value: {{ item.value }}
    {% endfor %}
    {% endif %}
          image: "{{ rke2_kubevip_image }}"
          name: kube-vip
          ports:
          - name: metrics
            containerPort: {{ rke2_kubevip_metrics_port | int }}
          resources: {}
          securityContext:
            capabilities:
              add:
              - NET_ADMIN
              - NET_RAW
          volumeMounts:
          - mountPath: /etc/kubernetes/admin.conf
            name: kubeconfig
      hostAliases:
      - hostnames:
        - kubernetes
        ip: 127.0.0.1
      hostNetwork: true
      serviceAccountName: kube-vip
      tolerations:
      - effect: NoSchedule
        operator: Exists
      - effect: NoExecute
        operator: Exists
      volumes:
      - hostPath:
          path: /etc/rancher/rke2/rke2.yaml
          type: File
        name: kubeconfig
  updateStrategy: {}

